function defineClass(data) {
	var classname = data.name;
	var superclass = data.extend || Object;
	var constructor = data.construct || function() {};
	var methods = data.methods || {};

	// 创建父类对象
	var proto = new superclass();

	// 删除父类prototype对象的原生属性
	for (var p in proto)
		if (proto.hasOwnProperty(p))
			delete proto[p];

	// 拷贝实例方法到prototype对象 p 为字符串类型
	for (var p in methods)
		proto[p] = methods[p];

	proto.constructor = constructor; // 重置为子类构造函数
	proto.superclass = superclass;
	if (classname)
		proto.classname = classname;

	// Associate the prototype object with the constructor function
	constructor.prototype = proto;

	return constructor;
}

var Foo = defineClass({
			name		: 'Foo',
			construct	: function(foo) {
				this.foo = foo;
			},
			methods		: {
				toString	: function() {
					return 'Descrption:\n foo:\t' + this.foo;
				}
			}
		});

/*var f = new Foo('foo');
alert(f.foo);
alert(f.toString());*/

var Bar = defineClass({
			name		: 'Bar',
			extend		: Foo,
			construct	: function(bar) {
				this.bar = bar;
			},
			methods		: {
				toString	: function() {
					return 'Descrption:\n bar:\t' + this.bar;
				}
			}
		});

var b = new Bar('bar');
alert(b.classname);
/*alert(b.foo);
alert(b.toString());*/